#!/bin/sh

#% Module
#%  description: wxPython-based GUI for GRASS GIS
#%  keywords: general, gui
#% End
#%option
#% key: workspace
#% type: string
#% description: Name of workspace file (.grc)
#% required : no
#%End

if [ -z "$GISBASE" ] ; then
    echo "You must be in GRASS GIS to run this program." 1>&2
    exit 1
fi

if [ $# -eq 0 ] ; then
    python "$GISBASE/etc/wxpython/wxgui.py" &
    exit 0
fi

if [ "$1" != "@ARGS_PARSED@" ] ; then
  exec g.parser "$0" "$@"
fi

if test -n "$GIS_OPT_WORKSPACE" ; then
    # load workspace file
    python "$GISBASE/etc/wxpython/wxgui.py" "--workspace" "$GIS_OPT_WORKSPACE" &
else
    python "$GISBASE/etc/wxpython/wxgui.py" &
fi

exit 0
